package com.gxa.controller;

import com.gxa.service.StorageService;
import com.gxa.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
public class StorageController {
  
  @Autowired
  private StorageService storageService;

  @RequestMapping("/storage/decrease")
  public Result decrease(@RequestParam("productId")Long productId, @RequestParam("count")Integer count) {
    log.info("---productId--{}--count-{}------",productId,count);
    this.storageService.decrease(productId, count);
    return new Result().ok();
  }
}